package editImage;

import imageViewHelper.ImageViewDragableListener;
import imageViewHelper.ImageViewResizeHandler;
import main.cs4295_asg2_cameraapps.MainActivity;
import main.cs4295_asg2_cameraapps.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class EditImageMain extends Activity {
	Activity self = this;
	ImageView frame, underImg;
	Button btnHome;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_edit_image_main);
		

        underImg = (ImageView) this.findViewById(R.id.underImg);
        underImg.setImageDrawable(underImg.getResources().getDrawable(R.drawable.wallpaper));
        ImageViewDragableListener underImgDL = new ImageViewDragableListener(underImg);
        ImageViewResizeHandler.resizeImageView(underImg, 1.0f);
        underImg.setOnTouchListener(underImgDL);
        
        
        frame = (ImageView) this.findViewById(R.id.frame);
        frame.setImageDrawable(frame.getResources().getDrawable(R.drawable.frame01));
        //ImageViewResizeHandler.resizeImageView(frame, 1.0f);
        frame.setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				underImg.dispatchTouchEvent(event);
				return true;
			}
		});
        
        //button to back home
        this.btnHome = (Button) this.findViewById(R.id.btnEditImage_Home);
        this.btnHome.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent switchAct = new Intent(self, MainActivity.class);
				self.startActivity(switchAct);
			}
		});
        
        
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.edit_image_main, menu);
		return true;
	}

}
